package design.pattern.Iterator;

public class IteratorImpl implements Iterator {

    List list = null;

    volatile int index = 0;

    public IteratorImpl(List list) {
        this.list = list;
    }

    @Override
    public Object next() {
        Object o = list.get(index);
        index++;
        return o;
    }

    @Override
    public Boolean hasNext() {
        return index<this.list.size();
    }

    @Override
    public Object first() {
        return null;
    }

    @Override
    public Object last() {
        return null;
    }
}
